﻿
<div class="form-horizontal" ms-controller="JHGL">
    <div class="form-group">
        <label class="col-xs-2 control-label"><i>*</i>开关状态</label>
        <div class="col-xs-4">
            <select class="form-control" ms-duplex="modelData.JHStatus">
                <option value="0">开</option>
                <!--<option value="1">关</option>-->
            </select>
        </div>
    </div>
   
    <div class="form-group" style="display:none">
        <label class="col-xs-2 control-label"><i>*</i>单位组织</label>
        <div class="col-xs-4">
            <input type="text" disabled="disabled"  class="form-control  szhl_require" ms-duplex="modelData.BranchNo" />
        </div>
        <span class="input-group-addon" style="width:72px;height:34px;" ms-click="seldw()">选择单位组织</span>

    </div>
    <div class="form-group">
        <label class="col-xs-2 control-label">起始年月</label>
        <div class="col-xs-4">
            <input class="szhl_form_date_mon form-control " ms-duplex="modelData.SDate" />
        </div>
    </div>
    <div class="form-group">
        <label class="col-xs-2 control-label">截止年月</label>
        <div class="col-xs-4">
            <input class="szhl_form_date_mon form-control"  ms-duplex="modelData.EDate"  onchange="tempmodel.gettitle()"  />
        </div>
    </div>
    <div class="form-group">
        <label class="col-xs-2 control-label"><i>*</i>计划名称</label>
        <div class="col-xs-9">

            <input class="szhl_require form-control"  type="text" ms-duplex="modelData.JHTitle" />
        </div>
    </div>
    <div class="form-group" style="display:none">
        <label class="col-xs-2 control-label"></label>
        <div class="col-xs-9 text-primary" >
            填写新计划会将之前的计划状态变为关闭状态
        </div>
    </div>
    


</div>
<script>
    var tempmodel = avalon.define({
        $id: "JHGL",
        name: "计划管理",
        modelData: { "JHTitle": "", "SDate": "", "EDate": "", "BranchNo": "", "BranchName": "", "JHStatus": "0" },
        iswf: false,//是否属于流程表单
        seldw: function () {
            top.ComFunJS.winbtnwin("/ViewV5/AppPage/XTGL/BranchSelect.html", "选择单位", 500, 470, {}, function (layero, index) {
                var frameid = $("iframe", $(layero)).attr('id');
                var branch = ComFunJS.isIE() ? top.window.frames[frameid].getselectedbranch() : top.window.frames[frameid].contentWindow.getselectedbranch();
                tempmodel.modelData.BranchNo = branch.branchid;
                tempmodel.modelData.BranchName = branch.branchname;
                top.layer.close(index)

            })
        },
        gettitle: function () {
            var title = tempmodel.modelData.SDate.replace("-", "年") + "月至" + tempmodel.modelData.EDate.replace("-", "年") + "月资金计划";
            if (tempmodel.modelData.SDate.substring(0, 4) == tempmodel.modelData.EDate.substring(0, 4)) {
                title = tempmodel.modelData.SDate.replace("-", "年") + "月至" + tempmodel.modelData.EDate.substring(5) + "月资金计划";
            }
            tempmodel.modelData.JHTitle = title;
        },
        inittemp: function (strId) {
            if (strId) {
                //编辑加载数据
                $.getJSON('/API/VIEWAPI.ashx?Action=JHGL_GETMODEL', { P1: strId }, function (resultData) {
                    if (resultData.ErrorMsg == "") {
                        tempmodel.modelData = resultData.Result;
                        setTimeout(" ComFunJS.initForm()", 500)
                    }
                })
            } else {
                ComFunJS.initForm()
            }
        },//初始化
        SaveData: function (callback) {
            $.post("/API/VIEWAPI.ashx?ACTION=JHGL_ADDJHGL", { P1: JSON.stringify(tempmodel.modelData.$model) }, function (result) {
                return callback.call(this, result);
            });
        }
    });//# sourceURL=JHGL.js;
</script>